package csse3004.GD;

import java.util.ArrayList;
import java.util.List;
/**
 *
 * @author Tom McNair - S41758984
 */
public class Account {
    
    public static String CREATED_TEMPLATE = "Congratulations, Your dbPoll account has been created" +
            "Your Password is %s";
    
    public enum AccountType {KeyUser, WBUser, PM, PC, PAdmin, SysAdmin};
    
    private String username;
    private int userID;
    private String password;
    private String email;
    private AccountType type;

    public int getUserID() {
        return userID;
    }

    public void setUserID(int userID) {
        this.userID = userID;
    }
    
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }
    
    public void setEmail(String p_email) {
        this.email = p_email;
    }

    public String getEmail() {
        return email;
    }

    public void setType(AccountType type) {
        this.type = type;
    }

    public AccountType getType() {
        return type;
    }
    
    public static List<String> getListAccountTypes() {
        List<String> roles = new ArrayList<String>();
        for (AccountType r : AccountType.values()) {
            if (r.name().equals("KeyUser"))
                roles.add("Keypad User");
            else if (r.name().equals("WBUser"))
                roles.add("Web User");
            else if (r.name().equals("PM"))
                roles.add("Poll Master");
            else if (r.name().equals("PC"))
                roles.add("Poll Creator");
            else if (r.name().equals("PAdmin"))
                roles.add("Poll Admin");
            else if (r.name().equals("SysAdmin"))
                roles.add("System Admin");
        }
        return roles;
    }
    
    public String getTypeString() {
        if (type == AccountType.KeyUser)
            return "KeyUser";
        if (type == AccountType.WBUser)
            return "WBUser";
        if (type == AccountType.PM)
            return "PM";
        if (type == AccountType.PC)
            return "PC";
        if (type == AccountType.PAdmin)
            return "PAdmin";
        if (type == AccountType.SysAdmin)
            return "SysAdmin";
        return "null";
    }

}
